package utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Desc: No Desc
 * @Author: wusonghe
 * @Date: 2019/3/13 17:14
 */
public class RegexUtils {

    public static void main(String[] args) {


        String text = "这里的话题有#kobe #lbj #cr7 是吧";

//        String text = "13522158842;托尔斯泰;test2;13000002222;8613111113313";
//        Pattern pattern = Pattern.compile("(?<!\\d)(?:(?:1[358]\\d{9})|(?:861[358]\\d{9}))(?!\\d)");
        Pattern pattern = Pattern.compile("#[^#\\n\\s*\\r]+");
        Matcher matcher = pattern.matcher(text);
        StringBuffer bf = new StringBuffer(64);
        while (matcher.find()) {
            bf.append(matcher.group()).append(",");
        }
        int len = bf.length();
        if (len > 0) {
            bf.deleteCharAt(len - 1);
        }

        System.out.println(bf.toString());
    }
}
